﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Tencent.OA.ACM.Entity.ReportCondition>" %>

<%@ Import Namespace="Tencent.OA.ACM.Entity" %>
<%@ Import Namespace="Tencent.OA.ACM.App" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">
    <link href="<%= this.Url.Content("~/Content/jquery.fmext.css") %>" rel="stylesheet"
        type="text/css" />

    <script type="text/javascript" language="javascript" src="<%=this.Url.Content("~/content/staffChooser.js") %>"></script>

    <script type="text/javascript" language="javascript" src="<%=this.Url.Content("~/content/Scripts/jquery.fmext.js") %>"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContainerPlaceHolder" runat="server">
    <div class="title ">
        统计报表
    </div>
    <%
        string display = "none";
        if (ViewData["hasCondition"] != null && ViewData["hasCondition"].ToString().Length > 0)
            display = "";
    
    %>
    <!--查询条件 Start-->
    <ul id="tags" class="tags">
        <li class="selectTag"><a href="#">班车统计报表</a></li>
        <li><a href='<%=this.Url.Content("~/Report/StationCount") %>'>班车路线站点统计</a></li>
    </ul>
    <div class="tagCon">
        <div id="tagContent2" class="tagContent ">
        </div>
    </div>
    <div id="condition" style="display: <%=display%>;">
        <%
            using (Html.BeginForm("Index", "Report", FormMethod.Get))
            {          
       
        %>
        <table cellpadding="0" cellspacing="0">
            <tr>
                <th>
                    路线名：
                </th>
                <td>
                    <%=Html.TextBoxFor(o=>o.RouteName) %>
                </td>
                <th>
                    时间范围：
                </th>
                <td>
                    <%=Html.TextBoxFor(o=>o.BeingTime,new {@class="form_text dateinput",style="width:93px;"}) %>
                    ~
                    <%=Html.TextBoxFor(o=>o.EndTime, new { @class = "form_text dateinput", style = "width:93px;" })%>
                </td>
                <th>
                    &nbsp;
                </th>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <th>
                </th>
                <td>
                    <input type="submit" class="form_bot" name="submit" value="查 询" onclick="return checkCondition();"
                        style="width: 100px;" />
                </td>
                <td colspan="4">
                </td>
            </tr>
        </table>
        <%=this.Html.Hidden("condition_hidden",
                (ViewData["conditon"] == null) ? "" : ViewData["conditon"]
                           ) %>
        <%} %>
    </div>
    <!--查询条件 end-->
    <!--列表查询two-->
    <div class="list_title">
        <div class="pag_right">
        </div>
        <div style="padding-top: 6px;">
            <input type="button" value="查询" class="form_bot" id="btn_query" onclick='$("#condition").show();' />
            <input type="button" value="导出" class="form_bot" onclick="exportExcel();" />
            <%--   <input type="button" value="修改" class="form_bot" />
            <input type="button" value="删除" class="form_bot" />--%>
        </div>
    </div>
    <table id="myFault" class="tblData" cellpadding="0" cellspacing="0" style="width: 100%">
        <thead>
            <tr class="lt_head">
                <th>
                    城 市
                </th>
                <th>
                    班车属性
                </th>
                <th>
                    路 线 名
                </th>
                <th>
                    平均载客人数
                </th>
                <th>
                    容纳人数
                </th>
                <th>
                    TOP3站点人数
                </th>
                <th>
                    操 作
                </th>
            </tr>
        </thead>
        <tbody id="gvList">
            <%
                IList<Tencent.OA.ACM.Entity.ReportCount> list = this.Model.DataList.PagedList;                
            %>
            <%=this.Html.ListTableNoResultMessage(list, 6)%>
            <%           
                foreach (ReportCount m in list)
                {
            %>
            <tr>
                <td>
                    <%=m.CityName %>
                </td>
                <td>
                    <%=m.BUSTypeName %>
                </td>
                <td>
                    <%=m.RouteName %>
                </td>
                <td style="color: <%=m.AvgPassengers>m.MaxPeoples?"Red":""%>">
                    <%=m.AvgPassengers %>
                </td>
                <td>
                    <%=m.MaxPeoples %>
                </td>
                <td>
                    <%=m.AvgStationCount %>
                </td>
                <td>
                    <a href="<%=this.Url.Content("~/Report/ReportDetail?RouteId="+m.RouteID) %>">详细</a>
                </td>
            </tr>
            <%
                }
           
            %>
        </tbody>
    </table>
    <!--翻页 Start-->
    <div class="paging">
        <%=Html.Pager<ReportCount>(this.Model.DataList)%>
    </div>
    <!--翻页 End-->

    <script language="javascript" type="text/javascript">
        var recordIsEmpty=<%=list.Count() %>;
        function checkCondition() {
            $("#condition INPUT[type=text]").each(function(){
                $(this).val($.trim($(this).val()));
            });
           
            if ($("#BeingTime").val() && $("#EndTime").val() && compareDate($("#BeingTime").val(), $("#EndTime").val())) {
                alert("结束时间不能早于开始时间！");
                return false;
            }
            else {return true;}
        }
        //导出Excel
        function exportExcel() {
            if (recordIsEmpty==0) {
                alert("记录为空，无法导出Excel！");
                return;
            }
            window.frames[0].document.getElementById("excelType").value="1";
            window.frames[0].document.forms[0].submit();
        }
    </script>

    <div style="display: none;">
        <iframe id="ifExportExcel" src="<%=this.Url.Content("~/Report/ExcelPost")%>"></iframe>
    </div>
</asp:Content>
